<script setup>
import { ref, computed } from 'vue'
import enLocale from './locales/lang/en/sys'
import zhLocale from './locales/lang/zh_CN/sys'

import Header from './components/Header.vue'

let electron = null
if (window.electron) {
  electron = window.electron
}
console.warn(electron)
const language = ref('zh-cn')
const locale = computed(() => (language.value === 'zh-cn' ? zhLocale : enLocale))

const ipInfo = ref('')
/**
 *
 * @returns 获取当前地区运营商
 *
 */
async function getNetIp() {
  // let DouYionEquipment = ``
  // // const SendData = {}
  // const response_ = await fetch(DouYionEquipment, {
  //   method: 'GET',
  //   headers: {
  //     'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
  //   },
  //   body: undefined
  // })
  // let response = await response_.json()
  // ipInfo.value = response.result
  // if (electron) {
  //   electron.ipcRenderer.sendSync('hnzjjszc', JSON.stringify(ipInfo.value))
  // }
  setTimeout(() => {
    ipInfo.value = 'response.result'
  }, 1000)
}
getNetIp()
</script>

<template>
  <div style="height: 100%">
    <el-config-provider :locale="locale" namespace="el" size="small">
      <!-- 头部 -->
      <Header></Header>
      <div v-if="!ipInfo" class="preloader">
        <img src="./assets/preloader.svg" alt="" />
      </div>
      <RouterView />
    </el-config-provider>
  </div>
</template>

<style lang="less">
@import './assets/css/styles.less';
</style>
